//dynamictab
$.fn.dynamictab = function(settings){
	 settings = jQuery.extend({
		 navid : '#nav',
		navtag : 'li',
	  navclass : 'on',
			ev : 'click',
		 index : 0,
	  callback : null
	 }, settings || {});
	 
	 return this.each(function(){
		 var container = this;
		 var navList = $(settings.navid).find(settings.navtag),
			 cur = settings.index,
			 cls = settings.navclass,
			 ev = settings.ev,
			 callback = settings.callback;
		 $(navList[cur]).addClass(cls);
		 
		 navList.each(function(i){
		     $(this).bind(settings.ev, function(event){
				 $(navList).removeClass(cls);
				 $(this).addClass(cls);
				 event.preventDefault();
				 if(settings.callback){
				     callback(this);
				 }
			 });
		 
		 });
		 
	 });
};

//tab
$.fn.mangoTabs = function(settings){
	 settings = jQuery.extend({
		 navid : 'nav',
		navtag : 'li',
	  navclass : 'on',
	   panelid : 'panel',
	  paneltag : 'div',
	panelclass : 'panel',
			ev : 'click',
		 index : 0,
	  callback : null
	 }, settings || {});
	 
	 return this.each(function(){
		 var container = this;
		 
		 var navList = $('#'+settings.navid).find(settings.navtag),
		     panelList = $('.'+settings.panelclass, '#'+settings.panelid),
			 cur = settings.index,
			 cls = settings.navclass,
			 ev = settings.ev,
			 callback = settings.callback;
		 $(navList).removeClass(cls); 
		 $(navList[cur]).addClass(cls);
		 $(panelList).hide();
		 $(panelList[cur]).show();
		 navList.each(function(i){
		     $(this).bind(settings.ev, function(event){
				 $(navList).removeClass(cls);
				 $(panelList).hide();
				 $(this).addClass(cls);
				 $(panelList[i]).show();
				 event.preventDefault();
				 if(settings.callback){
				     callback(this, $(panelList).get(i));
				 }
			 });
		 
		 });
		 
	 });
};



$(document).ready(function(){
	


	
	$('#hotelnav').dynamictab({navid:'#hotelul', navtag:'a', ev:'mouseover'});

	$('#selectSearch').mangoTabs({navid:'selectSearch', navtag:'dt', panelid:'selectSearch', paneltag:'dd', panelclass:'searchdd', index:0, callback:function(){
	     $('#gnhotel').attr('checked', 'checked');
	}});
	

	
});



